package com.fcy.musicplayer

import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.os.Handler
import android.os.Looper
import android.view.MotionEvent
import com.fcy.musicplayer.helps.UserHelp
import kotlinx.coroutines.flow.flow
import java.util.*

class WelcomeActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_welcome)
        object : TimerTask() {
            override fun run() {
                val intent: Intent = if (UserHelp.instance.validateLogin(this@WelcomeActivity)) {
                    Intent(this@WelcomeActivity, MainActivity::class.java)
                } else {
                    Intent(this@WelcomeActivity, LogInActivity::class.java)
                }
                finish()
                startActivity(intent)
            }
        }.also {
            Timer().schedule(it, 1000)
        }
    }


}